package com.zack.shop.mvp.model;

import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.zack.shop.mvp.contract.CartContract;
import com.zack.shop.mvp.http.api.service.CartService;
import com.zack.shop.mvp.http.entity.BaseGoodBean;
import com.zack.shop.mvp.http.entity.cart.CartBean;

import io.reactivex.Observable;
import okhttp3.RequestBody;

/**
 * @Author 张迁-zhangqian
 * @Data 2018/6/9 下午1:09
 * @Package com.zack.shop.mvp.model
 **/
public class CartModel extends BaseModel implements CartContract.Model {

    public CartModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }




    @Override
    public Observable<BaseGoodBean<CartBean>> list(RequestBody info) {
        return mRepositoryManager.obtainRetrofitService(CartService.class)
                .list();
    }

    @Override
    public Observable<BaseGoodBean> addAndUpdateProduct(RequestBody info) {
        return mRepositoryManager.obtainRetrofitService(CartService.class)
                .addAndUpdateProduct(info);
    }

    @Override
    public Observable<BaseGoodBean> deleteProduct(RequestBody info) {
        return mRepositoryManager.obtainRetrofitService(CartService.class)
                .deleteProduct(info);
    }
}
